package com.cloud.product.controller;

import com.cloud.product.bean.Product;
import com.cloud.product.service.ProductService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lx
 * @date 2025/11/10
 * @Description
 */
@RestController
public class ProductController {

    @Resource
    private ProductService productService;

    // 查询商品
    @GetMapping("/product/{id}")
    public Product getProduct(@PathVariable("id") Long id,
                              HttpServletRequest request) {
        System.out.println("------------------"+request.getHeader("X-Token")+"------------------");
        System.out.println("hello");
        return productService.getProduct(id);
    }
}
